﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Routing;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using Core.Interfaces;
using Core.Common;
using Microsoft.AspNet.SignalR;

namespace SonCa.SocialNetwork
{
    public class Global : System.Web.HttpApplication
    {
        [Import]
        public IRedirector _redirector;


        void Application_Start(object sender, EventArgs e)
        {
            RouteTable.Routes.MapHubs();

            MEFManager.Compose(this);
            RegisterRouters(RouteTable.Routes);            
        }

        void Application_End(object sender, EventArgs e)
        {
            //  Code that runs on application shutdown

        }

        public static void RegisterRouters(RouteCollection routeCollection)
        {
            routeCollection.MapPageRoute("ProfileRoute", "profiles/{username}", "~/Profiles/Profile.aspx");
        }

        void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs

        }

        void Session_Start(object sender, EventArgs e)
        {
            // Code that runs when a new session is started

        }

        void Session_End(object sender, EventArgs e)
        {
            // Code that runs when a session ends. 
            // Note: The Session_End event is raised only when the sessionstate mode
            // is set to InProc in the Web.config file. If session mode is set to StateServer 
            // or SQLServer, the event is not raised.

        }

    }
}
